package com.zyl.Ecs.auth.service.impl;

import com.github.yulichang.base.MPJBaseServiceImpl;
import com.zyl.Ecs.auth.mapper.PermissionMapper;
import com.zyl.Ecs.auth.service.PermissionService;
import com.zyl.Ecs.common.domain.auth.bean.Permission;
import com.zyl.Ecs.common.domain.auth.ext.PermissionExt;
import com.zyl.Ecs.common.exception.EcsException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


/**
* @version v1.0
* @Package: com.zyl.Ecs.auth.service.impl
* @ClassName: PermissionServiceImpl
* @Description 针对表【base_permission】的数据库操作Service实现
* @Author 翟玉龙
* @Date 2024-12-04 16:36:41
*/

@Service
@RequiredArgsConstructor
public class PermissionServiceImpl extends MPJBaseServiceImpl<PermissionMapper, Permission>
    implements PermissionService{

    private final PermissionMapper permissionMapper;

    /**
     * 获取权限列表
     * @return {@link List }<{@link PermissionExt }>
     * @throws EcsException 异常
     */
    @Override
    public List<PermissionExt> getList() throws EcsException {
        return permissionMapper.selectList(null)
                .stream()
                .map(PermissionExt::toExt) /* 转Ext类型 */
                .collect(Collectors.toList());
    }
}




